import {getToken,setToken,removeToken} from '@/utils/auth'
const state = {
  token: getToken()//直接读取本地token
}
const mutations = {
  // token存到本地
setToken(state,token){

state.token = token
setToken(token)


},
// 删除token
removeToken(state){
  state.token = '',
  removeToken()
}
}
const actions = {
  login(context,data){
    console.log(data);
    context.commit('setToken','123456')

  }
}
export default {
  namespaced:true,
  state,
  mutations,
  actions
}